package com.linxiao.payment.enums;

import com.ruoyi.common.exception.UtilException;

import java.util.Arrays;

/**
 * 支付方式枚举
 */
public enum PayMethodEnums {
    WXPAY(1, "wxpay", "微信提现", "wxPayTransferManager"),
    ALIPAY(2, "alipay", "支付宝提现", "AliPayTransferManager");

    private Integer code;
    private String insCode;
    private String msg;
    private String service;


    public static PayMethodEnums getPayMethodEnums(Integer code) {
        return Arrays.stream(values()).filter((item) -> {
            return item.code.equals(code);
        }).findFirst().orElseThrow(() -> {
            return new UtilException("biz animal type is not exist");
        });
    }

    public static PayMethodEnums getPayMethodEnumsByInsCode(String insCode) {
        return Arrays.stream(values()).filter((item) -> {
            return item.insCode.equals(insCode);
        }).findFirst().orElseThrow(() -> {
            return new UtilException("biz animal type is not exist");
        });
    }

    PayMethodEnums(Integer code, String insCode, String msg, String service) {
        this.code = code;
        this.insCode = insCode;
        this.msg = msg;
        this.service = service;
    }

    public Integer getCode() {
        return code;
    }

    public String getInsCode() {
        return insCode;
    }

    public String getMsg() {
        return msg;
    }

    public String getService() {
        return service;
    }
}
